home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
misc
/
emu
/
ATUtilities.lha
/
ATUtilities
/
reg.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-09-26
|
7KB
|
215 lines
#include <exec/types.h>
#include <libraries/dos.h>
#include <intuition/intuition.h>
#include "register.h"
struct Library *ATUtilitiesBase;
struct Library *GfxBase;
struct Library *IntuitionBase;
VOID Kill();
VOID main()
{
BOOL ende,bool;
UBYTE *vn,*nn,*st,*la,*pl,*or,*co;
UWORD z;
REGISTER UWORD i,j;
REGISTER ULONG Class;
register struct TextFont *opal;
register struct Window *win;
register struct RastPort *rp;
register struct IntuiMessage *msg;
register struct Gadget *gad;
struct FileHandle *fh;
bool=FALSE;
GfxBase=OpenLibrary("graphics.library",0L);
if(GfxBase==NULL) exit(0);
IntuitionBase=OpenLibrary("intuition.library",0L);
if(IntuitionBase==NULL) exit(0);
ATUtilitiesBase=OpenLibrary("at-utilities.library",0);
if(ATUtilitiesBase!=NULL)
{
win=CreateStdWindow("ATUtilities - Shareware-Registrierung",
25,25,590,173,CLOSEWINDOW|GADGETUP,
WINDOWCLOSE|WINDOWDRAG|WINDOWDEPTH|ACTIVATE);
if(win!=NULL)
{
rp=win->RPort;
opal=GetOpalFont();
if(opal) SetFont(rp,opal);
SelectStdFPen(rp);
CreateBoolGadget(win,15,155,150,12,"Registrieren",1);
CreateBoolGadget(win,170,155,150,12,"Abbruch",2);
CreateBoolGadget(win,420,155,150,12,"Information",3);
vn=CreateStringGadget(win,150,89,420,12,NULL,50,0);
nn=CreateStringGadget(win,150,101,420,12,NULL,50,0);
st=CreateStringGadget(win,150,113,420,12,NULL,50,0);
la=CreateStringGadget(win,150,125,40,12,NULL,4,0);
pl=CreateIntegerGadget(win,195,125,80,12,NULL,6,0);
or=CreateStringGadget(win,280,125,290,12,NULL,50,0);
co=CreateStringGadget(win,150,141,420,12,NULL,31,0);
WriteText(rp,40,25,"ATUtilities - Shareware-Registrierung:");
WriteText(rp,10,40,"Informationen, wie Sie die ATUtilities registrieren lassen, finden Sie in");
WriteText(rp,10,50,"der Datei \"Registrierung.dok\". Haben Sie ihre Registrierkarte zurück,");
WriteText(rp,10,60,"so lesen Sie vor der Dateneingabe auf jeden fall die Eingabehinweise!");
WriteText(rp,10,75,"Klicken Sie \"Abbruch\" oder geben Sie Ihre Registrierdaten ein.");
WriteText(rp,20,98,"Vorname:");
WriteText(rp,20,110,"Nachname:");
WriteText(rp,20,122,"Str./Nummer:");
WriteText(rp,20,134,"Land/Plz./Ort:");
WriteText(rp,20,150,"Reg. Code:");
ende=FALSE;
while(ende==FALSE)
{
WaitPort(win->UserPort);
msg=GetMsg(win->UserPort);
Class=msg->Class;
gad=msg->IAddress;
ReplyMsg(msg);
switch(Class)
{
case CLOSEWINDOW:
ende=TRUE;
break;
case GADGETUP:
switch(gad->GadgetID)
{
case 1:
Kill(vn,50);
Kill(nn,50);
Kill(st,50);
Kill(la,4);
Kill(pl,6);
Kill(or,50);
Kill(co,31);
strcpy(&Kunde.Vorname,vn);
strcpy(&Kunde.Nachname,nn);
strcpy(&Kunde.Straße,st);
strcpy(&Kunde.Land,la);
strcpy(&Kunde.Postleitzahl,pl);
strcpy(&Kunde.Ort,or);
strcpy(&Kunde.Code,co);
RefreshGadgets(win->FirstGadget,win,NULL);
i=0;
z=GetStringCode(vn,CODE_VN);
i+=TestCode(co,z,VN1,VN2,VN3,VN4);
z=GetStringCode(nn,CODE_NN);
i+=TestCode(co,z,NN1,NN2,NN3,NN4);
z=GetStringCode(st,CODE_ST);
i+=TestCode(co,z,ST1,ST2,ST3,ST4);
z=GetStringCode(la,CODE_LA);
i+=TestCode(co,z,LA1,LA2,LA3,LA4);
z=GetStringCode(pl,CODE_PL);
i+=TestCode(co,z,PL1,PL2,PL3,PL4);
z=GetStringCode(or,CODE_OR);
i+=TestCode(co,z,OR1,OR2,OR3,OR4);
z=GetCodeCode(co);
i+=TestCodeCode(co,z,CO1,CO2,CO3,CO4);
if(i!=0)
{
MultiRequest("Ihre Registrier-Angaben sind fehlerhaft!",
"Bitte prüfen Sie die Eingaben!","Okay",NULL);
}
else
{
ende=TRUE;
bool=TRUE;
}
break;
case 2:
ende=TRUE;
break;
case 3:
InformationBox("ATUtilities Registrierung - Information",
"$VER: Registrierung - Version 4.0",
"Copyright (C) 1993 by",
"Thomas Dreibholz",
"All rights reserved.",
"AT:Icons/Register");
break;
}
break;
}
}
DeleteStdWindow(win);
if(bool==TRUE)
{
win=CreateStdWindow("ATUtilities - Shareware-Registrierung",
25,25,590,162,CLOSEWINDOW,
WINDOWCLOSE|WINDOWDRAG|WINDOWDEPTH|ACTIVATE);
if(win!=NULL)
{
rp=win->RPort;
if(opal) SetFont(rp,opal);
SelectStdFPen(rp);
WriteText(rp,15,25,"Eingetragener Benutzer:");
WriteText(rp,15,40,&Kunde.Vorname);
WriteText(rp,15,50,&Kunde.Nachname);
WriteText(rp,15,65,"Folgende Programme wurden registriert:");
i=GETPRG(Kunde.Code);
j=80;
for(z=0;z<SYS_COUNT;z++)
{
if((i & Programs[z].Code) || (Programs[z].Code==0))
{
WriteText(rp,15,j,Programs[z].Name);
j+=10;
}
}
WaitPort(win->UserPort);
msg=GetMsg(win->UserPort);
ReplyMsg(msg);
fh=Open("AT:ATUtilities.reg",MODE_NEWFILE);
if(fh!=NULL)
{
Write(fh,&Kunde,sizeof(struct Kunde));
Close(fh);
}
else
{
InfoRequest("Reg-Datei konnte nicht gesichert werden!");
}
DeleteStdWindow(win);
}
else
{
InfoRequest("Kein Speicher für Fenster!");
}
}
if(opal) CloseFont(opal);
}
else
{
InfoRequest("Kein Speicher für Fenster!");
}
CloseLibrary(ATUtilitiesBase);
}
else
{
printf("Keine ATUtilities-Library!\n");
}
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
exit(0);
}
VOID Kill(str,len)
UBYTE *str;
UWORD len;
{
WORD i;
for(i=len;i>strlen(str);i--)
{
str[i]=0x00;
}
for(i=(strlen(str))-1;i>0;i--)
{
if(str[i]==' ') str[i]=0x00; else break;
}
}